Imports System.Collections.Generic

Public Class RenameExt

  Private mPath As String
  Public Property Path() As String
    Get
      Return mPath
    End Get
    Set(ByVal value As String)
      mPath = value
    End Set
  End Property

  Private mExtIn As String
  Public Property ExtIn() As String
    Get
      Return mExtIn
    End Get
    Set(ByVal value As String)
      mExtIn = value
    End Set
  End Property
  Private mExtOut As String
  Public Property ExtOut() As String
    Get
      Return mExtOut
    End Get
    Set(ByVal value As String)
      mExtOut = value
    End Set
  End Property

  Sub Rename()
    Dim di As New IO.DirectoryInfo(Path)
    Dim lst As New List(Of IO.FileInfo)
    For Each fi As IO.FileInfo In di.GetFiles("*." & ExtIn)
      lst.Add(fi)
    Next
    For Each fi As IO.FileInfo In lst
      fi.MoveTo(IO.Path.Combine(fi.Directory.FullName, fi.Name.Substring(0, fi.Name.Length - ExtIn.Length) & ExtOut))
    Next
  End Sub
  <STAThread()> _
  Shared Sub Main()
    Dim re As New RenameExt
    re.Path = "C:\Documents and Settings\philips\My Documents"
    re.ExtIn = "rar"
    re.ExtOut = "html"
    re.Rename()
  End Sub


End Class
